/*------验证手机号-------*/
exports.isPhone = (phone)=>{
    if(/^[1][3,4,5,7,8][0-9]{9}$/.test(phone)){
        return true;
    }else{
        return false;
    }
};

/*------设置cookie------*/
exports.setCookie = (key, value)=>{
	const days = 1;
	const exp = new Date();
	exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
	document.cookie = `${key}=${value}; expires=${exp.toGMTString()}`;
};


/*-------获取参数--------*/
exports.query = (key)=>{
	let search = window.location.search.split("?")[1];
	let obj = {};
	if(search){
		let search_arr = search.split("&");
		for(let i = 0; i < search_arr.length; i ++){
			let arr = search_arr[i].split("=");
			obj[arr[0]] = arr[1];
		};
	};
	if(key){
		return obj[key];
	}else{
		return obj;
	}
};